﻿using FX_API;
using FX_API.Models;
using log4net.Appender;
using log4net.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace BamaTeaWebAPI.LogAppenders
{
    public class FXMessageAppender : AppenderSkeleton
    {
        protected override void Append(LoggingEvent loggingEvent)
        {
            FenxiangAPI.SendMessage(new FXMessage()
            {
                corpAccessToken = FenxiangAPI.corpAccessToken,
                corpId = FenxiangAPI.corpId,
                msgType = "text",
                text = new Text() { content = loggingEvent.RenderedMessage },
                toUser = FenxiangAPI.NoticeUserId.Split(',').ToList()
            });
        }
    }
}